package com.strings;

/**
 * compareTo比较两个字符串对象一不一样长，相等0，  a < b 返回负数； a >b 返回正数
 */

public class CompareTo {
    public static void main(String args[]) {
        String str1 = "Strings";
        String str2 = "Strings";
        String str3 = "Strings123";

        int result = str1.compareTo( str2 );
        System.out.println(result);

        result = str2.compareTo( str3 );
        System.out.println(result);

        result = str3.compareTo( str1 );
        System.out.println(result);
         //0
        //-3
        // 3
    }
}
